import utils from './factory/utils';
// import weixin from './factory/weixin';

export function setRouter(Router) {
  var router = new Router({hashbang: true});
  // router.mode = 'html5';
  router.map({
    '/': {
      name: 'index',
      component: require('./views/index'),
      share: true,
      title: '预约课程'
    },
    '/uc': {
      name: 'uc',
      component: require('./views/uc'),
      share: false,
      title: '个人中心'
    },
    '/mylessons': {
      name: 'mylessons',
      component: require('./views/mylessons'),
      share: false,
      title: '我的课程'
    },
    '/lesson': {
      name: 'lesson',
      component: require('./views/lesson'),
      share: true,
      title: '课程详情'
    },
    '/notice': {
      name: 'notice',
      component: require('./views/notice'),
      share: false,
      title: '提醒通知'
    },
    '/payrecord': {
      name: 'payrecord',
      component: require('./views/payrecord'),
      share: false,
      title: '充值记录'
    },
    '/pay': {
      name: 'pay',
      component: require('./views/pay'),
      share: false,
      title: '充值'
    },
    '/settings': {
      name: 'settings',
      component: require('./views/uc'),
      share: false,
      title: '通用设置'
    },
    '/feedback': {
      name: 'feedback',
      component: require('./views/feedback'),
      share: false,
      title: '意见反馈'
    },
    '/userinfo': {
      name: 'userinfo',
      component: require('./views/userinfo'),
      share: false,
      title: '用户信息'
    },
    '/evaluate': {
      name: 'evaluate',
      component: require('./views/evaluate'),
      share: false,
      title: '课程评价'
    },
    '/myfav': {
      name: 'myfav',
      component: require('./views/myfav'),
      share: false,
      title: '我的收藏'
    }
  });

  router.beforeEach(function() {
  });

  router.afterEach(() => {
    let defaultTitle = {
      returnApply: '退货申请'
    }[router._currentRoute.name] || '上艺术课';
    utils.setTitle(defaultTitle);
    // weixin.setWx(router._currentRoute);
  });

  router.start(require('./views/App'), 'app');
}
